package cn.iocoder.yudao.module.erp.controller.app.product;

import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.erp.controller.app.product.vo.product.ErpAppProductPageReqVO;
import cn.iocoder.yudao.module.erp.controller.app.product.vo.product.ErpAppProductRespVO;
import cn.iocoder.yudao.module.erp.service.product.ErpProductService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;

import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;

@Tag(name = "应用端 - ERP 产品")
@RestController
@RequestMapping("/erp/product")
@Validated
public class ErpAppProductController {

    @Resource
    private ErpProductService productService;



    @GetMapping("/page")
    @Operation(summary = "获得产品分页")
    public CommonResult<PageResult<ErpAppProductRespVO>> getProductPage(@Valid ErpAppProductPageReqVO pageReqVO) {
        return success(productService.getAppProductVOPage(pageReqVO));
    }

    @GetMapping("/get")
    @Operation(summary = "获得产品")
    public CommonResult<ErpAppProductRespVO> getProduct(@RequestParam("id") Long id) {
        return success(productService.getAppProduct(id));
    }




}
